package com.andkrup.easygame.shooter {
	import com.andkrup.geom.Vector2D;	
	
	import flash.geom.Point;	
	
	import com.andkrup.easygame.game.objects.weapons.IWeapon;	
	import com.andkrup.easygame.game.objects.ITarget;	

	/**
	 * @author Andkrup
	 * 
	 * This utility class contains methods that helps calculate battles involving
	 * firearms
	 */
	public class FireFight {
		/**
		 * Calculate hit probability and subtract damage from target, if target
		 * gets it.
		 */
		public static function resolveSingleShot(weapon:IWeapon, target:ITarget, markmanship:uint = 0):void{
			// calculate hit and subtract damage from target if hit;
		}
		/**
		 * Returns a new recoil value for the weapon to use, if the weapon is to
		 * be fired again
		 */
		public static function resolveContinousFire(weapon:IWeapon, target:ITarget, roundsFired:uint, recoil:uint, markmanship:uint = 0):uint {
			// calculate hit and subtract damage from target if hit;
			var rMod : uint = 1;
			return recoil * rMod;
		}
		
		/**
		 * Check if one or more vectors intersects a target.
		 * 
		 * Returns the vector(s) that intersects the target. The array is empty
		 * if no vector intersects.
		 */
		public static function hitTestVectors(vectors:Array, object:ITarget):Array{
			var arr:Array = [];
			for each(var v:Vector2D in vectors){
				if(object.hitTest(v)){
					arr.push(v);
				}
			}
			return arr;
		}
		
		/**
		 * Return random vectors within the degrees of the inaccuracy parameter.
		 * The inaccuracy is the range of inaccuracy at the target in degrees.
		 */
		public static function randomScatterShots(vector:Vector2D, inaccuracy:Number, shotsFired:uint = 1):Array{
			return null;
		}
	}
}
